home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************
- *
- * Source-Name: WM_Source2.c
- * Compiler : Lattice 5.02
- * Funktion : verschiedene-Strukturen erstellen
- * Autor : Arno Pichler
- * Besonderes : wird zu Window-Maschine gelinkt
- *
- ************************************************************************/
-
- #include <WM.h>
- #include <MS.h>
- #include <MyStructs.h>
-
- USHORT MenuSource()
- {
- status=0;
- if((Erlaubt & 16)==0) return(0);
- helpM=helpW->MenuStrip;
- if(CodeArt==0)
- {
- while(helpM->Next)
- helpM=helpM->Next;
- }
- while(helpM)
- {
- MU++;
-
- /************************************************************************
- * Assembler --- MenuListeNr: ---
- ************************************************************************/
-
- if(CodeArt==1 && status==0)
- {
- MUL++;
- status=1;
- sprintf(Buffer,"%s%s%d:",String[15],String[5],MUL);
- if(LSave()) return(1);
- }
-
- /************************************************************************
- * C - Sourcecode MenuItem's ausgeben
- ************************************************************************/
-
- if(CodeArt==0)
- {
- if(ItemSource())
- return(1);
- }
-
- /************************************************************************
- * C - struct Menu --- MenuNr --- = {
- * Assembler - Menu --- Nr: ---
- ************************************************************************/
-
- StrEnd=0;
- if(CodeArt==0) sprintf(Buffer,"%s%s %s%d",STR,String[15],
- String[15],MU);
- else sprintf(Buffer,"%s%d",String[15],MU);
- if(CStart()) return(1);
-
- /************************************************************************
- * C und Assembler --- Nextes Menu oder NULL ---
- ************************************************************************/
-
- if(helpM->Next)
- {
- AssT(2);
- KUnd();
- i=MU-1;
- if(CodeArt) i=MU+1;
- InLeer(15,i);
- if(BuffKom()) return(1);
- }
- else if(Null(1)) return(1);
-
- /************************************************************************
- * C und Assembler --- LeftEdge,TopEdge ---
- ************************************************************************/
-
- if(Word(helpM->LeftEdge,helpM->TopEdge)) return(1);
-
- /************************************************************************
- * C und Assembler --- Width,Height ---
- ************************************************************************/
-
- if(Word(helpM->Width,helpM->Height)) return(1);
-
- /************************************************************************
- * C und Assembler --- MenuFlags ---
- ************************************************************************/
-
- AssT(1);
- if(helpM->Flags)
- {
- InBuff("MENUENABLED");
- if(KomTab()) return(1);
- }
- else if(Null(1)) return(1);
-
- /************************************************************************
- * C --- MenuName ---
- * Assembler --- Zeiger auf MenuName ---
- ************************************************************************/
-
- AssT(2);
- if(CodeArt)
- {
- sprintf(LEER,"%s%s%d",String[15],String[7],MU);
- BuffLeer();
- }
- else
- {
- if(Compiler) InBuff(CType[2]);
- SetByte(helpM->MName);
- }
- if(KomTab()) return(1);
-
- /************************************************************************
- * C und Assembler --- FirstItem ---
- ************************************************************************/
-
- AssT(2);
- KUnd();
- if(helpM->FirstItem)
- {
- i=MI;
- if(CodeArt) i++;
- helpJ=helpM->FirstItem;
- MakeName(helpJ->ItemName,i,16);
- if(LSave()) return(1);
- }
- else if(Null(0)) return(1);
- if(CodeArt==0)
- {
- CEnde();
- if(DSave()) return(1);
- }
- else
- {
- HTab();
- AssT(1);
- Nuller(3);
- if(LSave()) return(1);
- sprintf(Buffer,"%s%s%d:",String[15],String[7],MU);
- Tab();
- AssT(0);
- SetByte(helpM->MName);
- KommaNull(3);
- if(DSave()) return(1);
- if(ItemSource()) return(1);
- }
-
- /************************************************************************
- * Nextes Menu ermitteln
- ************************************************************************/
-
- if(CodeArt) helpM=helpM->Next;
- else helpM=helpM->Parent;
- }
-
- /************************************************************************
- * C --- #define MenuListeNr MenuNr ---
- ************************************************************************/
-
- if(CodeArt==0)
- {
- MUL++;
- sprintf(Buffer,"%s%s%s%d %s%d",String[6],String[15],
- String[5],MUL,String[15],MU);
- if(DSave()) return(1);
- }
- return(0);
- }
-
- /************************************************************************
- * MenuItem-Strukturen erstellen
- ************************************************************************/
-
- USHORT ItemSource()
- {
- actI=helpM->FirstItem;
- if(actI==NULL) return(0);
- ok=0;
- if(CodeArt==0)
- {
- while(actI->Next)
- actI=actI->Next;
- }
- while(actI)
- {
- MI++;
- if(SubSource()) return(1);
- helpJ=actI;
- if(ItemQuell(MI,16)) return(1);
- if(CodeArt) actI=actI->Next;
- else actI=actI->Parent;
- }
- return(0);
- }
-
- /************************************************************************
- * SubItem-Strukturen erstellen
- ************************************************************************/
-
- USHORT SubSource()
- {
- actS=actI->Sub;
- if(actS==NULL) return(0);
- ok=1;
- if(CodeArt==0)
- {
- while(actS->Next)
- actS=actS->Next;
- }
- while(actS)
- {
- SU++;
- helpJ=actS;
- if(ItemQuell(SU,17)) return(1);
- if(CodeArt) actS=actS->Next;
- else actS=actS->Parent;
- }
- return(0);
- }
-
- USHORT ItemExtra()
- {
- if(helpJ->ItemImage)
- {
- if(ImageSource(helpJ->ItemImage,0)) return(1);
- IMG=IM;
- }
- if(helpJ->SelectImage!=NULL && helpJ->ItemImage!=NULL)
- {
- if(ImageSource(helpJ->SelectImage,0)) return(1);
- IMS=IM;
- }
- if(helpJ->ItemText!=NULL && helpJ->ItemImage==NULL)
- {
- if(TextSource(helpJ->ItemText,0)) return(1);
- IT=TX;
- }
- if(helpJ->SelectText!=NULL && helpJ->ItemText!=NULL &&
- helpJ->ItemImage==NULL)
- {
- if(TextSource(helpJ->SelectText,0)) return(1);
- ST=TX;
- }
- return(0);
- }
-
- /************************************************************************
- * Item-Struktur erstellen ---
- ************************************************************************/
-
- USHORT ItemQuell(USHORT q,UBYTE string)
- {
- /************************************************************************
- * C - struct MenuItem --- ItemName oder ItemNr --- = {
- * Assembler - Item --- Name: oder Nr: ---
- ************************************************************************/
-
- if(CodeArt==0)
- {
- if(ItemExtra()) return(1);
- sprintf(Buffer,"%s%s ",STR,String[16]);
- }
- StrEnd=0;
- MakeName(helpJ->ItemName,q,string);
- if(CStart()) return(1);
-
- /************************************************************************
- * C und Assembler --- Nextes Item oder NULL ---
- ************************************************************************/
-
- if(helpJ->Next)
- {
- AssT(2);
- KUnd();
- i=q-1;
- if(CodeArt) i=q+1;
- MakeName(helpJ->Next->ItemName,i,string);
- if(KomTab()) return(1);
- }
- else if(Null(1)) return(1);
-
- /************************************************************************
- * C und Assembler --- LeftEdge,TopEdge ---
- ************************************************************************/
-
- if(Word(helpJ->LeftEdge,helpJ->TopEdge)) return(1);
-
- /************************************************************************
- * C und Assembler --- Width,Height ---
- ************************************************************************/
-
- if(Word(helpJ->Width,helpJ->Height)) return(1);
-
- /************************************************************************
- * C und Assembler --- Item-Flags ---
- ************************************************************************/
-
- AssT(1);
- d=7;
- if(helpJ->ItemImage!=NULL && helpJ->SelectImage!=NULL) d=4;
- else if(helpJ->ItemText!=NULL && helpJ->SelectText!=NULL) d=4;
- j=0;
- for(i=0; i<d; i++)
- {
- if((helpJ->Flags & MFLAGS[i]) == MFLAGS[i])
- {
- Plus();
- InBuff(MFLAGS1[i]);
- }
- }
- if(helpJ->Command != 0)
- {
- Plus();
- InBuff("COMMSEQ");
- }
- if(helpJ->ItemText!=NULL && helpJ->ItemImage==NULL)
- {
- Plus();
- InBuff("ITEMTEXT");
- if(helpJ->SelectText!=NULL)
- {
- Plus();
- InBuff(DEFS[8]);
- }
- }
- if(helpJ->ItemImage!=NULL && helpJ->SelectImage!=NULL)
- {
- Plus();
- InBuff(DEFS[8]);
- }
- if(j==0)
- {
- if(Null(1)) return(1);
- }
- else if(KomTab()) return(1);
-
- /************************************************************************
- * MutualExclude
- ************************************************************************/
-
- if(helpJ->Exclude)
- {
- AssT(2);
- HexCode(helpJ->Exclude);
- if(KomTab()) return(1);
- }
- else if(Null(1)) return(1);
-
- /************************************************************************
- * C und Assembler --- ItemFill ---
- ************************************************************************/
-
- strcpy(LEER,"");
- if(helpJ->ItemText!=NULL && helpJ->ItemImage==NULL)
- {
- if(CodeArt) sprintf(LEER,"I%s%d",String[4],TX+1);
- else sprintf(LEER,"%s&I%s%d",CType[1],String[4],IT);
- }
- if(helpJ->ItemImage)
- {
- if(CodeArt) InLeer(10,IM+1);
- else sprintf(LEER,"%s&%s%d",CType[1],String[10],IMG);
- }
- if(strlen(LEER))
- {
- AssT(2);
- if(BuffKom()) return(1);
- }
- else if(Null(1)) return(1);
-
- /************************************************************************
- * C und Assembler --- SelectFill ---
- ************************************************************************/
-
- strcpy(LEER,"");
- if(helpJ->SelectText!=NULL && helpJ->ItemText!=NULL &&
- helpJ->ItemImage==NULL)
- {
- if(CodeArt)
- {
- helpT=helpJ->ItemText;
- i=TX+1;
- while(helpT)
- {
- i++;
- helpT=helpT->NextText;
- }
- sprintf(LEER,"I%s%d",String[4],i);
- }
- else sprintf(LEER,"%s&I%s%d",CType[1],String[4],ST);
- }
- if(helpJ->SelectImage!=NULL && helpJ->ItemImage!=NULL)
- {
- if(CodeArt) InLeer(10,IM+2);
- else sprintf(LEER,"%s&%s%d",CType[1],String[10],IMS);
- }
- if(strlen(LEER))
- {
- AssT(2);
- if(BuffKom()) return(1);
- }
- else if(Null(1)) return(1);
-
- /************************************************************************
- * C und Assembler --- Command ---
- ************************************************************************/
-
- AssT(0);
- if(helpJ->Command)
- {
- BType=CodeArt;
- CodeArt=1;
- LEER[0]=helpJ->Command;
- LEER[1]='\0';
- SetByte(LEER);
- CodeArt=BType;
- }
- else Nuller(0);
- KommaNull(0);
- if(KomTab()) return(1);
-
- /************************************************************************
- * C und Assembler --- SubItem oder NULL ---
- ************************************************************************/
-
- if(helpJ->Sub)
- {
- AssT(2);
- KUnd();
- i=SU;
- if(CodeArt) i++;
- MakeName(helpJ->Sub->ItemName,i,17);
- if(KomTab()) return(1);
- }
- else if(Null(1)) return(1);
-
- /************************************************************************
- * C und Assembler --- MENUNULL ---
- ************************************************************************/
-
- AssT(1);
- InBuff("MENUNULL");
- if(LSave()) return(1);
- if(CodeArt)
- {
- if(ItemExtra()) return(1);
- }
-
- /************************************************************************
- * C - };
- ************************************************************************/
-
- else
- {
- CEnde();
- if(DSave()) return(1);
- }
- return(0);
- }
-
-
-